<template>
    <div>
        <Card dis-hover >
            <h3>
                {{taskName}}
            </h3>
            <ButtonGroup slot="extra">
                <Button @click="approvalInfo" type="warning" style="background: #EF5350;" :loading="buttonloading" v-if="approval">
                    <Icon type="ios-bookmark" />
                    审批
                </Button>
                <Button @click="returnTo">
                    返回
                    <Icon type="ios-arrow-forward" />
                </Button>
            </ButtonGroup>
        </Card>
        <Row>
            <i-col span="24">
                <Card dis-hover style="margin: 10px;">
                    <Spin fix v-if="spinShow">
                        <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                        <div>Loading</div>
                    </Spin>
                    <div :style="{height: bodyHeight + 'px', overflowY: 'auto', overflowX: 'hidden', }">
                        <Form ref="formCustom2" :model="infoData" :rules="ruleCustom2" label-position="top">
                            <Row :gutter="16">
                                <i-col span="19">
                                    <Row :gutter="16">
                                        <i-col span="24">
                                            <FormItem label="单位名称：">
                                                <Input v-model="infoData.securityDirectorInfo.orgName" type="text" readonly/>
                                            </FormItem>
                                        </i-col>
                                    </Row>
                                    <Row :gutter="16">
                                        <i-col span="12">
                                            <FormItem label="姓名：">
                                                <Input v-model="infoData.securityDirectorInfo.userName" type="text" readonly/>
                                            </FormItem>
                                        </i-col>
                                        <i-col span="12">
                                            <FormItem label="性别：" prop="gender">
                                                <Select v-model="infoData.securityDirectorInfo.gender" disabled>
                                                    <Option v-for="(item, index) in genderList" :value="item.id" :key="index">{{item.label}}</Option>
                                                </Select>
                                            </FormItem>
                                        </i-col>
                                    </Row>
                                    <Row :gutter="16">
                                        <i-col span="12">
                                            <FormItem label="政治面貌：" prop="politicalAffiliation">
                                                <Input v-model="infoData.securityDirectorInfo.politicalAffiliationName" type="text" readonly/>
                                            </FormItem>
                                        </i-col>
                                        <i-col span="12">
                                            <FormItem label="出生年月：" prop="birthday" >
                                                <DatePicker v-model="infoData.securityDirectorInfo.birthday" type="date" placeholder="请选择出生年月" style="width: 100%" readonly></DatePicker>
                                            </FormItem>
                                        </i-col>
                                    </Row>
                                    <Row :gutter="16">
                                        <i-col span="12">
                                            <FormItem label="手机号码：" prop="phoneNumber">
                                                <Input type="text" v-model="infoData.securityDirectorInfo.phoneNumber" readonly/>
                                            </FormItem>
                                        </i-col>
                                        <i-col span="12">
                                            <FormItem label="学历：" prop="education">
                                                <Input v-model="infoData.securityDirectorInfo.educationName" type="text" readonly/>
                                            </FormItem>
                                        </i-col>
                                    </Row>
                                </i-col>
                                <i-col span="5">
                                    <div style="width:100%;  height: 100%;">
                                        <img :src="fileImgSrc" style="width:100%; height:100%"/>
                                    </div>
                                </i-col>
                            </Row>

                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="专业：" prop="major">
                                        <Input type="text" v-model="infoData.securityDirectorInfo.major" placeholder="请输入专业" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                                <i-col span="12">
                                    <FormItem label="现职务（岗位）：" prop="currentPosition">
                                        <Input type="text" v-model="infoData.securityDirectorInfo.currentPosition" placeholder="请输入现职务（岗位）" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="工作年限：" prop="workYear">
                                        <Input type="number" v-model="infoData.securityDirectorInfo.workYear" placeholder="请输入工作年限" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                                <i-col span="12">
                                    <FormItem label="与安全生产管理相关的工作年限：" prop="relevantWorkYear" >
                                        <Input type="number" v-model="infoData.securityDirectorInfo.relevantWorkYear" placeholder="请输入与安全生产管理相关的工作年限" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="任职资格：" prop="qualification">
                                        <Select v-model="infoData.securityDirectorInfo.qualification" disabled>
                                            <Option v-for="(item, index) in qualificationsList" :value="item.id" :key="index">{{item.label}}</Option>
                                        </Select>
                                    </FormItem>
                                </i-col>
                            </Row>

                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="注册安全工程师职业资格证书编号：" >
                                        <Input v-model="infoData.safetyEngineerQualificationCertificateNo" placeholder="请输入注册安全工程师职业资格证书编号" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="注册安全工程师职业资格证书：" >
                                        <Upload v-if="ifEdit"
                                                multiple
                                                ref="qualificationUpload"
                                                type="drag"
                                                name="files"
                                                :show-upload-list="false"
                                                :before-upload="beforeUpload"
                                                :action="fileUrl">
                                            <div style="padding: 20px 0">
                                                <Icon type="ios-cloud-upload" size="52" style="color: #F27874"></Icon>
                                                <p><span style="color: red">*</span>&nbsp;注册安全工程师职业资格证书</p>
                                            </div>
                                        </Upload>
                                        <div v-show="fileList.length>0" v-for="item in fileList" :key='item' style="margin: 3px">
                                            <a @click="downloadFile(item)">{{ item.fileName }} {{ item.name }}</a>
                                            <Button type="text" icon="md-trash" @click="remove1(item)"
                                                    style="margin-left: 5px;margin-bottom: 3px" v-if="ifEdit"/>
                                        </div>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="注册安全工程师执业证号：">
                                        <Input v-model="infoData.safetyEngineerCertificate" placeholder="请输入注册安全工程师执业证号" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="工程类中级及以上专业技术资格名称：" >
                                        <Input v-model="infoData.juniorSeniorProfressionalName" placeholder="请输入注册安全工程师执业证号" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                                <i-col span="12">
                                    <FormItem label="工程类中级及以上专业技术资格专业：" >
                                        <Input v-model="infoData.juniorSeniorProfressionalSkill" placeholder="请输入注册安全工程师执业证号" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="专业技术资格证上传：">
                                        <Upload v-if="ifEdit"
                                                multiple
                                                ref="technicalCertificateUpload"
                                                type="drag"
                                                name="files"
                                                :show-upload-list="false"
                                                :before-upload="beforeUpload2"
                                                :action="fileUrl2">
                                            <div style="padding: 20px 0">
                                                <Icon type="ios-cloud-upload" size="52" style="color: #F27874"></Icon>
                                                <p><span style="color: red">*</span>&nbsp;请上传专业技术资格证上传</p>
                                            </div>
                                        </Upload>
                                        <div v-show="fileList2.length>0" v-for="item in fileList2" :key='item' style="margin: 3px">
                                            <a @click="downloadFile(item)">{{ item.fileName }} {{ item.name }}</a>
                                            <Button type="text" icon="md-trash" @click="remove2(item)"
                                                    style="margin-left: 5px;margin-bottom: 3px" v-if="ifEdit"/>
                                        </div>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="任职时间：" prop="serviceTime">
                                        <DatePicker v-model="infoData.serviceTime" type="date" placeholder="请选择任职时间" style="width: 100%" :readonly="!ifEdit"></DatePicker>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="任职文件：" prop="workYear">
                                        <Upload v-if="ifEdit"
                                                multiple
                                                ref="appointmentUpload"
                                                type="drag"
                                                name="files"
                                                :show-upload-list="false"
                                                :before-upload="beforeUpload3"
                                                :action="fileUrl3">
                                            <div style="padding: 20px 0">
                                                <Icon type="ios-cloud-upload" size="52" style="color: #F27874"></Icon>
                                                <p><span style="color: red">*</span>&nbsp;请上传任职文件</p>
                                            </div>
                                        </Upload>
                                        <div v-show="fileList3.length>0" v-for="item in fileList3" :key='item' style="margin: 3px">
                                            <a @click="downloadFile(item)">{{ item.fileName }} {{ item.name }}</a>
                                            <Button type="text" icon="md-trash" @click="remove3(item)"
                                                    style="margin-left: 5px;margin-bottom: 3px" v-if="ifEdit"/>
                                        </div>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="工作经历：" prop="workExperience">
                                        <Input v-model="infoData.workExperience" type="textarea" :rows="4" placeholder="请输入工作经历" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="12">
                                    <FormItem label="单位安全生产管理机构名称：" prop="productionOrgId">
                                        <Input v-model="infoData.productionOrgName" :readonly="!ifEdit" v-if="!ifEdit"/>
                                        <orgDom ref="orgDom" @setOrgInfo="setOrgName" :orgInfo="{name: infoData.securityDirectorInfo.orgName}" v-else></orgDom>
                                    </FormItem>
                                </i-col>
                                <i-col span="12">
                                    <FormItem label="所属二级集团公司：" prop="workExperience">
                                        <Input v-model="infoData.twoLevelOrgName"  readonly/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="企业类型：" prop="enterpriseType">
                                        <CheckboxGroup v-model="infoData.enterpriseType">
                                            <Checkbox v-for="(item, index) in enterpriseTypeList" :key="index" :label="item.codingCodeId" :disabled="!ifEdit">{{item.codingName}}</Checkbox>
                                        </CheckboxGroup>
                                    </FormItem>
                                </i-col>
                            </Row>

                            <Row :gutter="16">
                                <i-col span="24">
                                    <FormItem label="其他需要说明的情况：" prop="remark">
                                        <Input v-model="infoData.remark" type="textarea" :rows="4" placeholder="请输入其他需要说明的情况" :readonly="!ifEdit"/>
                                    </FormItem>
                                </i-col>
                            </Row>

                        </Form>
                        <Divider orientation="left" v-if="approval">操作信息</Divider>
                        <Form ref="formCustom" :model="formData" :rules="ruleCustom" label-position="top">
                            <Row :gutter="16">
                                <i-col span="8" v-if="ifRoute">
                                    <FormItem label="审批意见：" prop="route">
                                        <Select filterable v-model="formData.route" @on-change="changeRoute">
                                            <Option v-for="item in routeList" :value="item.id" :key="item.id">{{ item.name }}</Option>
                                        </Select>
                                    </FormItem>
                                </i-col>
                                <i-col span="8" v-if="ifTwoLevelCompanyLeader">
                                    <FormItem label="二级集团领导：" prop="dynamicAudits">
                                        <Select v-model="formData.dynamicAudits">
                                            <Option v-for="(item, index) in leaderList" :value="item.userId" :key="index">{{item.userName}}
                                                <span style="float:right;color:#ccc">{{item.orgName}} （{{item.positionName }}）</span>
                                            </Option>
                                        </Select>
                                    </FormItem>
                                </i-col>
                                <i-col span="8" v-if="ifGroupLeader">
                                    <FormItem label="集团领导：" prop="dynamicAudits">
                                        <Select v-model="formData.dynamicAudits">
                                            <Option v-for="(item, index) in leaderList" :value="item.userId" :key="index">{{item.userName}}
                                                <span style="float:right;color:#ccc">{{item.orgName}} （{{item.positionName }}）</span>
                                            </Option>
                                        </Select>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16" v-if="approval">
                                <i-col span="8">
                                    <FormItem label="操作人：">
                                        <Input v-model="formData.userName" readonly/>
                                    </FormItem>
                                </i-col>
                                <i-col span="8">
                                    <FormItem label="操作时间：">
                                        <Input v-model="formData.createDateStr" readonly/>
                                    </FormItem>
                                </i-col>
                            </Row>
                            <Row :gutter="16" v-if="approval">
                                <i-col span="24">
                                    <FormItem label="说明：" prop="opinion">
                                        <Input type="textarea" v-model="formData.opinion"/>
                                    </FormItem>
                                </i-col>
                            </Row>
                        </Form>
                    </div>
                </Card>
            </i-col>
        </Row>

    </div>
</template>

<script>

    import {Api} from '../../../api'
    import {sessionStorage} from '@/common/cacheUtils.js';
    import orgDom from "@/components/input-org.vue";
    import userDom from "@/components/input-user.vue";

    export default {
        name: "securityDirectorRegisterForm",
        components:{
            orgDom,
            userDom
        },
        data(){
            return{
                visible: false,
                fileImgSrc: '',
                fileUrl: '',
                fileUrl2: '',
                fileUrl3: '',
                taskName: '',
                buttonloading: false,
                approval: false,
                spinShow: false,
                bodyHeight: '',
                formData:{},
                ruleCustom: {
                    route: [
                        {
                            type: 'integer',
                            required: true,
                            message: '  ',
                            trigger: 'blur,change'
                        }
                    ],
                    dynamicAudits: [
                        {
                            required: true,
                            message: '  ',
                            trigger: 'blur,change'
                        }
                    ],
                },
                infoData: {
                    securityDirectorInfo: {}
                },
                genderList: [
                    {
                        id: '男',
                        label: '男'
                    },
                    {
                        id: '女',
                        label: '女'
                    }
                ],
                qualificationsList:[
                    {
                        id: '符合',
                        label: '符合'
                    },
                    {
                        id: '视同符合',
                        label: '视同符合'
                    }
                ],
                politicalAffiliationList: [],
                educationList: [],
                userInfo: sessionStorage('userId').getObject('userId'),
                taskInfo: {},
                bodyHeight: '',
                ifRoute: false,
                ifEdit: false,
                ifSealFile: false,
                ifTwoLevelCompanyLeader: false,
                ifGroupLeader: false,
                variables: {},
                routeList: [
                    {
                        id: 1,
                        name: '合格'
                    },
                    {
                        id: 2,
                        name: '不合格'
                    }
                ],
                ruleCustom2: {

                },
                leaderList: [],
                fileList: [],
                fileList2: [],
                fileList3: [],
                enterpriseTypeList: [],

            }
        },
        mounted(){
            this.bodyHeight = window.innerHeight - 175;
            this.taskName = this.$route.query.taskName;
            this.taskInfo = this.$route.query;
            if(this.taskInfo.status == 'done' || this.taskInfo.status == 'self') this.approval = false; else this.approval = true;
            this.selectCodingSort();
            this.query();
        },
        methods: {
            selectCodingSort(){
                this.$http.get(Api.queryCodeDetailBySortId + '/SEC-00001', {params: {}}).then((res) => {
                    this.enterpriseTypeList = res.data.data;
                });
            },
            query(){
                this.$http.get(Api.securityDirectorRegister + '/'+ this.taskInfo.workId ).then(function(response) {
                    if(response.data.status == 200) {
                        this.infoData = response.data.data;
                        if(this.infoData.enterpriseType!=undefined){
                            this.$set(this.infoData, 'enterpriseType', this.infoData.enterpriseType.split(','));
                        }
                        this.$http.get(Api.uploadPTWFiles   + '/' + this.infoData.infoId + '/files/picture', {params: {field: 'photo'}}).then((res) => {
                            if(res.data.data!=undefined){
                                if(res.data.data!=undefined){
                                    res.data.data.forEach(item=>{
                                        this.fileImgSrc = item.picture;
                                    })
                                }
                            }
                        });

                        this.$http.get(Api.uploadPTWFiles   + '/' + this.infoData.id + '/files/guideFile').then((res) => {
                            if(res.data.data!=undefined){
                                res.data.data.forEach(item=>{
                                    if(item.field == 'qualification'){
                                        this.fileList.push(item);
                                    }else if(item.field == 'technicalCertificate'){
                                        this.fileList2.push(item);
                                    }else if(item.field == 'appointment'){
                                        this.fileList3.push(item);
                                    }
                                })
                            }
                        });

                        if(this.taskInfo.status == 'done' || this.taskInfo.status == 'self')
                            this.spinShow = false;
                        else
                            this.queryFormList();
                    }
                })
            },
            queryFormList(){
                this.$http.get(Api.getProcinstForm + '/'+ this.taskInfo.taskId).then(function(response){
                    if(response.data.formList.length!=0){
                        response.data.formList.map((i)=>{
                            if(i.id == 'route') this.ifRoute = true;
                            else if(i.id == 'edit'){
                                this.ifEdit = true;
                                this.fileUrl = Api.uploadPTWFiles  + '/' + this.infoData.id + '/files/guideFile/qualification';
                                this.fileUrl2 = Api.uploadPTWFiles  + '/' + this.infoData.id + '/files/guideFile/technicalCertificate';
                                this.fileUrl3 = Api.uploadPTWFiles  + '/' + this.infoData.id + '/files/guideFile/appointment';
                                setTimeout(() => {
                                    this.$refs.orgDom.setCurrentOrg();
                                }, 300);
                            }
                            else if(i.id == 'twoLevelCompanyLeader'){
                                this.ifTwoLevelCompanyLeader = true;
                                this.queryLeader(this.infoData.twoLevelOrgId,this.infoData.twoLevelOrgName );
                            }
                            else if(i.id == 'groupLeader'){
                                this.ifGroupLeader = true;
                                this.queryLeader('18000000');
                            }
                        });
                        this.spinShow = false;
                    }else{
                        this.spinShow = false;
                    }
                    this.variables = response.data.variables;
                    this.formData = {
                        userName: this.userInfo.userName,
                        taskId: this.taskInfo.taskId,
                        createUserId: this.userInfo.userId,
                        createDateStr: this.formatDate(new Date(), 'yyyy-MM-dd'),
                        procinstId: this.taskInfo.procinstId,
                    }
                })
            },
            approvalInfo(){
                if(this.ifEdit == true) this.saveInfo();
                this.$refs['formCustom'].validate((valid) => {
                    if(valid){
                        this.buttonloading = true;
                        this.$http.get(Api.taskComplete, {
                            params: this.formData
                        }).then(function(response){
                            if(response.data.status == 200){
                                this.$Message.success({content: '保存成功', duration: 4});
                                this.screenMessage();
                                this.returnTo();
                            }else{
                                this.$Message.error({ content: '保存失败', duration: 4});
                            }
                            this.buttonloading = false;
                        });
                    }else{
                        this.$Message.error({ content: '请填写完整！', duration: 4});
                    }
                });
            },
            returnTo(){
                this.$router.go(-1);
            },
            saveInfo(){
                if(this.infoData.enterpriseType!=undefined){
                    this.infoData.enterpriseType = this.infoData.enterpriseType.toLocaleString();
                }
                this.fileList.map((i)=>{
                    if(i.operation=='add'){
                        this.$refs.qualificationUpload.post(i);
                    }
                });
                this.fileList2.map((i)=>{
                    if(i.operation=='add'){
                        this.$refs.technicalCertificateUpload.post(i);
                    }
                });
                this.fileList3.map((i)=>{
                    if(i.operation=='add'){
                        this.$refs.appointmentUpload.post(i);
                    }
                });
                this.$http.put(Api.securityDirectorRegister,this.infoData);
            },
            queryLeader(orgId, orgName ){
                this.$http.get(Api.securityDirectorInfo + '/leader' , {params: {companyId: orgId, orgName: orgName}}).then((res) => {
                    this.leaderList = res.data.data;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            beforeUpload(file){
                file.operation = 'add';
                this.fileList.push(file);
                return false;
            },
            beforeUpload2(file){
                file.operation = 'add';
                this.fileList2.push(file);
                return false;
            },
            beforeUpload3(file){
                file.operation = 'add';
                this.fileList3.push(file);
                return false;
            },
            downloadFile(file) {
                let url = Api.uploadPTWFiles + '/file/' + file.id;
                this.$http.get(url, {
                    responseType: 'blob'      //告诉服务器我们需要的响应格式
                }).then((res) => {
                    console.log(res)
                    const aLink = document.createElement("a");
                    let blob = new Blob([res.data], {
                        type: res.bodyBlob.type      //将会被放入到blob中的数组内容的MIME类型
                    });
                    aLink.href = URL.createObjectURL(blob)
                    aLink.download = file.fileName //标题
                    aLink.click()
                    document.body.appendChild(aLink)
                })
            },
            remove1(file) {
                this.fileList.splice(this.fileList.indexOf(file), 1);
                if(file.id!=undefined){
                    let url = Api.uploadMongoFile + '/' + file.id;
                    this.$http.delete(url);
                }
            },
            remove2(file){
                this.fileList2.splice(this.fileList2.indexOf(file), 1);
                if(file.id!=undefined){
                    let url = Api.uploadMongoFile + '/' + file.id;
                    this.$http.delete(url);
                }
            },
            remove3(file){
                this.fileList3.splice(this.fileList3.indexOf(file), 1);
                if(file.id!=undefined){
                    let url = Api.uploadMongoFile + '/' + file.id;
                    this.$http.delete(url);
                }
            },
            setOrgName(data){
                this.$set( this.formData, 'productionOrgId', data.orgId );
                this.$set( this.formData, 'productionOrgName', data.orgName );
                this.queryTwolevelOrg(data.orgId);
            },
            queryTwolevelOrg(orgId){
                this.$http.get(Api.securityDirectorInfo + '/twoLevelOrg' , {params: {companyId: orgId}}).then((res) => {
                    if(res.data.status == 200){
                        if(res.data.data != null){
                            this.$set(this.formData, 'twoLevelOrgId', res.data.data.orgId);
                            this.$set(this.formData, 'twoLevelOrgName', res.data.data.orgName);
                        }
                    }
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            formatDate(date, fmt) {
                if (typeof date == 'string') {
                    return date;
                }
                if (!fmt) fmt = "yyyy-MM-dd hh:mm:ss";
                if (!date || date == null) return null;
                let o = {
                    'M+': date.getMonth() + 1, // 月份
                    'd+': date.getDate(), // 日
                    'h+': date.getHours(), // 小时
                    'm+': date.getMinutes(), // 分
                    's+': date.getSeconds(), // 秒
                    'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
                    'S': date.getMilliseconds() // 毫秒
                }
                if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
                for (let k in o) {
                    if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
                }
                return fmt
            },
            changeRoute(id){
                if(this.taskName == '企业领导'){
                    if(id==1){
                        this.ifTwoLevelCompanyLeader = true;
                    }else{
                        this.ifTwoLevelCompanyLeader = false;
                    }
                }else if(this.taskName == '二级集团领导'){
                    if(id==1){
                        this.ifGroupLeader = true;
                    }else{
                        this.ifGroupLeader = false;
                    }
                }
            },
            screenMessage(){
                if(this.taskName == '企业领导'){
                    if(this.formData.route == 1){
                        this.sendMessage(this.formData.dynamicAudits);
                    }else {
                        this.sendMessage(this.variables['reportUser']);
                    }
                }else if(this.taskName == '二级集团领导'){
                    if(this.formData.route == 1){
                        this.sendMessage(this.formData.dynamicAudits);
                    }else {
                        this.sendMessage(this.variables['reportUser']);
                    }
                }
            },
            sendMessage(userId){
                let data = {userId: userId, content: "您有一条企业安全总监登记表要审批，请登录安全环保信息平台进行审批" };
                this.$http.post(Api.sendMessage ,data);
            }

        }
    }
</script>

<style scoped>

</style>
